import { Module } from 'vuex'
import RootStateTypes from '../../interface'
import BrowserStateType from './interface'

const browser: Module<BrowserStateType, RootStateTypes> = {
    namespaced: true,
    state: (): BrowserStateType => ({
        innerWidth: window.innerWidth,
        innerHeight: window.innerHeight,
    }),
    mutations: {
        setLoading(state, payload: BrowserStateType) {
            state.innerWidth = payload.innerWidth
            state.innerHeight = payload.innerHeight
        },
    },
}

export default browser
